#include <cstdio>
#include <cstring>

int f[ 101 ][ 101 ][ 2 ];

int main( )
{
    int t, cas, n, m, i, j;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%d%d%d", &cas, &n, &m);
        memset( f, 0, sizeof( f ) );
        f[ 0 ][ 0 ][ 0 ] = 1;
        for ( i = 1; i <= n; i++ )
        {
            for ( j = 0; j <= m; j++ )
            {
                f[ i ][ j ][ 0 ] = f[ i - 1 ][ j ][ 0 ] + f[ i - 1 ][ j ][ 1 ];
                f[ i ][ j ][ 1 ] = f[ i - 1 ][ j ][ 0 ] + f[ i - 1 ][ j - 1 ][ 1 ];
            }
        }
        printf("%d %d\n", cas, f[ n ][ m ][ 0 ] + f[ n ][ m ][ 1 ]);
    }
    return 0;
}